package com.fxp.project.jiuselu.web.business.v1.controller.article;

import com.fxp.project.jiuselu.web.base.controller.BaseController;
import com.fxp.project.jiuselu.web.domain.CommonPage;
import com.fxp.project.jiuselu.web.domain.CommonResult;
import com.fxp.project.jiuselu.web.models.article.request.ReqAtricles;
import com.fxp.project.jiuselu.web.models.article.service.IjslArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 资讯Controller
 *
 * @author Jason.Wang
 * @date 2021-10-18
 */
@RestController
@RequestMapping("/v1/article/")
public class JslArticleController extends BaseController {

    @Autowired
    private IjslArticleService ijslArticleService;


    /**
     * @return com.fxp.project.jiuselu.web.domain.CommonResult
     * @Description 获取文章列表
     * @Date 10:39 2021/12/31
     * @Param [reqAtricles, result]
     * @Author M_
     **/
    @PostMapping("list")
    @CrossOrigin
    public CommonResult list(@RequestBody @Validated ReqAtricles reqAtricles, BindingResult result) {
//        super.checkBindResult(result);
        return CommonResult.success(CommonPage.restPage(ijslArticleService.selectArticleListPageInfo(reqAtricles)));
    }
}
